package com.bosssoft.permission.centre.api;

import com.bosssoft.permission.centre.entity.Department;
import com.bosssoft.permission.centre.entity.Position;
import com.bosssoft.permission.centre.entity.Role;
import com.bosssoft.permission.centre.pojo.dto.pcp.UserDTO;
import com.bosssoft.permission.centre.pojo.query.UserQuery;
import com.bosssoft.permission.centre.pojo.vo.ResourceVO;
import com.bosssoft.permission.centre.pojo.vo.UserVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;
import com.bosssoft.permission.centre.entity.User;
import javax.validation.Valid;
import java.util.List;

/**
 * @Author: wang
 * @Time: 2022/3/24
 */
@CrossOrigin
@Api(tags = "用户管理 ", value = "/permission/centre/v1/user")
@RequestMapping(value = "/permission/centre/v1/user")
public interface UserApi {

    @GetMapping(value = "/getUserResource")
    List<ResourceVO> getUserResourceVO(Long id);
    /**
     * @param: 商品DTO
     * @return: 成功则true CommonResponse 应答码和消息统一参考基础框架
     * @see
     * @since
     */


    @PostMapping(value = "")
    @ResponseBody
    Boolean add(@RequestBody @Valid UserDTO userDTO);


    /**
     * @param: 删除用户，若有对应角色则中间表用户-角色也需一并删除
     * @return: 成功则true CommonResponse 应答码和消息统一参考基础框架
     * @see
     * @since
     */

    @DeleteMapping(value = "")
    @ResponseBody
    Boolean remove(@ApiParam(value = "当前行id", required = true) @RequestParam("id") Long id,
                   @ApiParam(value = "当前行版本", required = true) @RequestParam("version") Long version);


    /**
     * @param: 用户DTO
     * @return: 成功则true CommonResponse 应答码和消息统一参考基础框架
     * @see
     * @since
     */
    @ApiOperation(tags = "修改用户", value = "")
    @PutMapping(value = "")
    @ResponseBody
    Boolean modify(@Valid @RequestBody UserDTO userDTO);

    /**
     * @param: 用户DTO
     * @return: 成功则true CommonResponse 应答码和消息统一参考基础框架
     * @see
     * @since
     */
    @ApiOperation(tags = "修改用户角色", value = "")
    @PutMapping(value = "/modifyWithNewRole")
    @ResponseBody
    Boolean modifyWithNewRole(@Valid @RequestBody UserDTO[] userDTOS);

    /**
     * @param: 用户查询条件
     * @return: 用户VO
     * @see
     * @since
     */

    @GetMapping(value = "")
    @ResponseBody
    List<User> commonQuery(UserQuery userQuery);


    /**
     * @param: 用户ID
     * @return: 用户VO
     * @see
     * @since
     */

    @GetMapping(value = "{id}")
    @ResponseBody
    UserVO queryUserById(@PathVariable("id") Long id);

    /**
     * @param:
     * @return:
     * @see
     * @since
     */
    @ApiOperation(tags="查询所有角色",value="")
    @GetMapping(value = "/queryAllRole")
    @ResponseBody
    List<Role> queryAllRole();

    /**
     * @param:
     * @return:
     * @see
     * @since
     */
    @ApiOperation(tags="查询所有部门",value="")
    @GetMapping(value = "/queryAllDepartment")
    @ResponseBody
    List<Department> queryAllDepartment();

    /**
     * @param:
     * @return:
     * @see
     * @since
     */
    @ApiOperation(tags="查询所有职业",value="")
    @GetMapping(value = "/queryAllPosition")
    @ResponseBody
    List<Position> queryAllPosition();



    /**
     * @param: 用户DTO数组
     * @return: 成功则true CommonResponse 应答码和消息统一参考基础框架
     * @see
     * @since
     */
    @ApiOperation(tags="批量修改用户",value="")
    @PutMapping(value = "/batchUpdate")
    @ResponseBody
    Boolean batchUpdate( @Valid @RequestBody UserDTO[] userDTOS);
    /**
     * @param: 用户DTO数组
     * @return: 成功则true CommonResponse 应答码和消息统一参考基础框架
     * @see
     * @since
     */
    @ApiOperation(tags="批量删除用户",value="")
    @DeleteMapping(value = "/batchDelete")
    @ResponseBody
    Boolean batchDelete( @Valid @RequestBody  UserDTO[] userDTOS);

    @ApiOperation(tags="批量删除用户",value="")
    @GetMapping(value = "/firstStartMd5")
    @ResponseBody
    Boolean firstStartMd5();


}
